﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using xIx.Web.AccessControl;
using System.Collections.Generic;

namespace MC
{
    //[ParseChildren(true)]
    //[PersistChildren(false)]
    //[PersistenceMode(PersistenceMode.InnerProperty)]
    //[Designer(typeof(System.Web.UI.Design.ControlDesigner))]
 
    public class QAReplyCtl : xIx.Web.Portal.SimpleFormBase
    {

        protected void Page_Load(object sender, EventArgs e)
        {

        }


        protected override bool CollectValues(Dictionary<string, object> vd)
        {
            vd.Add("IsReply", true);
            vd.Add("RUserID", Page.User.AccountInfo.ID);
            vd.Add("RUserTitle", Page.User.AccountInfo.Name);
            vd.Add("RText", GetIptText("RText"));
            vd.Add("RDate", DateTime.Now);
            return true;
        }
        protected override bool DisplayValues(DataRow dr)
        {
            if (null != dr)
            {
                this.DataBind();
                this.DataBindChildren();

                //SetIptText("Title", dr["Title"].ToString());
                //SetIptText("QUserTitle", dr["QUserTitle"].ToString());
                //SetIptText("QText", dr["QText"].ToString());
                //SetIptText("QDate", dr["QDate"].ToString());
                //SetIptText("QUserDesc", dr["QUserDesc"].ToString());
                //SetIptText("QType", dr["QType"].ToString());
                //SetIptText("Image", dr["ExtA"].ToString());

                //SetIptText("RUserTitle", dr["RUserTitle"].ToString());
                //SetIptText("RText", dr["RText"].ToString());
                //SetIptText("RDate", dr["RDate"].ToString());
                return true;
            }
            else return false;
        }

        protected override void OnAfterSave(Dictionary<string, object> vd, int r)
        {
            if (r == 1)
            {
                Alert("保存成功。");
            }
            else
            {
                Alert("保存失败。");
            }
            ReloadView();
        }
        public string UseUserImgSelCtl(string k)
        {
            UserImgSelectorCtlBase f = FindControlEx(k) as UserImgSelectorCtlBase;
            if (null == f) return null;

            f.SaveFile();
            return f.Text;
        }

        public override string TableName
        {
            get { return "Sys_QABoard"; }
        }

        public override string FieldsForDisplay
        {
            get { return "*"; }
        }
    }
}